Delay import of ssl in pex.fetcher.#2417
Merged
jsirois merged 8 commits intopex-tool:mainfrom Jun 5, 2024
Merged
Conversation
jsirois
commented
Jun 5, 2024
| stderr_fp.flush() | ||
| stderr_fp.seek(0) | ||
| stderr = stderr_fp.read() | ||
| assert b"MonkeyPatchWarning: Monkey-patching ssl after ssl " not in stderr, stderr.decode( |
Member
Author
There was a problem hiding this comment.
The failure at this commit looks like:
> assert b"MonkeyPatchWarning: Monkey-patching ssl after ssl " not in stderr, stderr.decode(
"utf-8"
)
E AssertionError: /tmp/pytest-of-jsirois/pytest-52/test_gevent_monkeypatch0/pex_root/unzipped_pexes/d0b0f145223b1d7c391f024af1f2baa4bebd475f/app.py:2: MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. Please monkey-patch earlier. See https://github.com/gevent/gevent/issues/1016. Modules that had direct imports (NOT patched): ['pex.fetcher (/tmp/pytest-of-jsirois/pytest-52/test_gevent_monkeypatch0/pex_root/unzipped_pexes/d0b0f145223b1d7c391f024af1f2baa4bebd475f/.bootstrap/pex/fetcher.py)'].
E monkey.patch_all()
jsirois
commented
Jun 5, 2024
| install_command = | ||
| docs,check,typecheck,py{py27,py35,py36,py37,py38,py39,py310,27,35,36,37,38,39,310,311,312,313}: \ | ||
| python -m pip install {opts} {toxinidir} {packages} | ||
| python -m pip install {opts} -e {toxinidir} {packages} |
Member
Author
There was a problem hiding this comment.
This was needed to ensure non-stale Pex on the test sys.path. Toggling back and forth between the aggressive and lazy import ssl I noticed the Pex state was sticky. Fallout from #2408 just noticed now.
benjyw
approved these changes
Jun 5, 2024
…project.toml projects.
huonw
approved these changes
Jun 5, 2024
jsirois
added a commit
to jsirois/pex
that referenced
this pull request
Jun 6, 2024
Previously the test could hang when the log fifo was closed by the gunicorn server before the port was written to the log; now it fails. Follow up to pex-tool#2417 which introduced the test and led to observed hangs in CI.
jsirois
added a commit
that referenced
this pull request
Jun 7, 2024
Previously the test could hang when the log fifo was closed by the gunicorn server before the port was written to the log; now it fails when this happens. Follow up to #2417 which introduced the test and led to observed hangs in CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This acts as an affordance for users of the gevent monkey patch system,
avoiding warnings about potential imports of
sslpre-monkey-patching.Fixes #2415